package com.wallet.my.config;

import com.wallet.my.service.EthService;
import com.wallet.my.service.ListenerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 监听新区块交易的自启动
 **/
@Component
public class ListenerRun implements ApplicationRunner {
    @Autowired
    private ListenerService listenerService;
    @Autowired
    private EthService ethService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        List<String> allAddress = ethService.getAllAddress();
        listenerService.listenTransRecord(allAddress);
    }
}
